From 67a8d065863d93a815120751aec7c3f6ca248622 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Sun, 8 Jul 2018 15:54:58 +0200 Subject: [PATCH] babl: export more symbols Adding babl_chromaticities_make_space, babl_trc and babl_trc_gamma to public api and ability to setup arbitrary BablSpaces without loading from ICC profiles. --- babl/babl-icc.c | 2 +- babl/babl-internal.h | 35 ----------------------------------- babl/babl-space.c | 34 +++++++++++++++++----------------- babl/babl.h | 38 ++++++++++++++++++++++++++++++++++++++ export-symbols | 2 ++ 5 files changed, 58 insertions(+), 53 deletions(-) diff --git a/babl/babl-icc.c b/babl/babl-icc.c index 973da7f..918b81e 100644 --- a/babl/babl-icc.c +++ b/babl/babl-icc.c @@ -883,7 +883,7 @@ babl_icc_make_space (const char *icc_data, double wZ = icc_read (s15f16, offset + 8 + 4 * 2); babl_free (state); - ret = (void*) babl_space_from_chromaticities (NULL, + ret = (void*) babl_chromaticities_make_space (NULL, wX / (wX + wY + wZ), wY / (wX + wY + wZ), red_x, red_y, diff --git a/babl/babl-internal.h b/babl/babl-internal.h index 150fabd..8645f90 100644 --- a/babl/babl-internal.h +++ b/babl/babl-internal.h @@ -386,26 +386,6 @@ const Babl *babl_space_match_trc_matrix (const Babl *trc_red, float gx, float gy, float gz, float bx, float by, float bz); -/** - * babl_space_from_chromaticities: - * - * Creates a new babl-space/ RGB matrix color space definition with the - * specified CIE xy(Y) values for white point: wx, wy and primary - * chromaticities: rx,ry,gx,gy,bx,by and TRCs to be used. After registering a - * new babl-space it can be used with babl_space() passing its name; - * - * Internally this does the math to derive the RGBXYZ matrix as used in an ICC - * profile. - */ -const Babl * babl_space_from_chromaticities (const char *name, - double wx, double wy, - double rx, double ry, - double gx, double gy, - double bx, double by, - const Babl *trc_red, - const Babl *trc_green, - const Babl *trc_blue, - int equalize_matrix); /** * babl_space_from_rgbxyz_matrix: @@ -424,21 +404,6 @@ babl_space_from_rgbxyz_matrix (const char *name, const Babl *trc_green, const Babl *trc_blue); -/** - * babl_trc_gamma: - * - * Creates a Babl TRC for a specific gamma value, it will be given - * a name that is a short string representation of the value. - */ -const Babl * babl_trc_gamma (double gamma); - -/** - * babl_trc: - * - * Look up a TRC by name, "sRGB" "1.0" "linear" and "2.2" are recognized - * strings in a stock babl configuration. - */ -const Babl * babl_trc (const char *name); int _babl_file_get_contents (const char *path, char **contents, diff --git a/babl/babl-space.c b/babl/babl-space.c index 5d5086a..7e96832 100644 --- a/babl/babl-space.c +++ b/babl/babl-space.c @@ -300,7 +300,7 @@ babl_space_from_rgbxyz_matrix (const char *name, } const Babl * -babl_space_from_chromaticities (const char *name, +babl_chromaticities_make_space (const char *name, double wx, double wy, double rx, double ry, double gx, double gy, @@ -377,14 +377,14 @@ void babl_space_class_init (void) { #if 0 - babl_space_from_chromaticities ("sRGB", + babl_chromaticities_make_space ("sRGB", 0.3127, 0.3290, /* D65 */ 0.6400, 0.3300, 0.3000, 0.6000, 0.1500, 0.0600, babl_trc("sRGB"), NULL, NULL, 1); #else - babl_space_from_chromaticities ("sRGB", + babl_chromaticities_make_space ("sRGB", 0.3127, 0.3290, /* D65 */ 0.639998686, 0.330010138, 0.300003784, 0.600003357, @@ -394,7 +394,7 @@ babl_space_class_init (void) /* hard-coded pre-quantized values - to match exactly what is used in standards see issue #18 */ #endif - babl_space_from_chromaticities ("Rec2020", + babl_chromaticities_make_space ("Rec2020", 0.3127, 0.3290, /* D65 */ 0.708, 0.292, 0.170, 0.797, @@ -402,7 +402,7 @@ babl_space_class_init (void) // XXX: is using sRGB TRC right? babl_trc("sRGB"), NULL, NULL, 1); - babl_space_from_chromaticities ( + babl_chromaticities_make_space ( "Adobish", /* a space that can be used as a place-holder for a sRGB like space with displaced green coordinates from a big graphics software vendor that would rather not it's name be directly used when referring to this color space, @@ -414,7 +414,7 @@ computations of uniform gray axis */ 0.1500, 0.0600, babl_trc("2.2"), NULL, NULL, 1); - babl_space_from_chromaticities ( + babl_chromaticities_make_space ( "ProPhoto", 0.34567, 0.3585, /* D50 */ 0.7347, 0.2653, @@ -422,7 +422,7 @@ computations of uniform gray axis */ 0.0366, 0.0001, babl_trc("1.8"), NULL, NULL, 1); - babl_space_from_chromaticities ( + babl_chromaticities_make_space ( "Apple", 0.3127, 0.3290, /* D65 */ 0.6250, 0.3400, @@ -431,7 +431,7 @@ computations of uniform gray axis */ babl_trc("1.8"), NULL, NULL, 1); #if 0 - babl_space_from_chromaticities ( + babl_chromaticities_make_space ( "WideGamut", 0.34567, 0.3585, /* D50 */ 0.7350, 0.2650, @@ -439,7 +439,7 @@ computations of uniform gray axis */ 0.1570, 0.0180, babl_trc("2.2"), NULL, NULL, 1); - babl_space_from_chromaticities ( + babl_chromaticities_make_space ( "Best", 0.34567, 0.3585, /* D50 */ 0.7347, 0.2653, @@ -447,7 +447,7 @@ computations of uniform gray axis */ 0.1300, 0.0350, babl_trc("2.2"), NULL, NULL, 1); - babl_space_from_chromaticities ( + babl_chromaticities_make_space ( "Beta", 0.34567, 0.3585, /* D50 */ 0.6888, 0.3112, @@ -455,7 +455,7 @@ computations of uniform gray axis */ 0.1265, 0.0352, babl_trc("2.2"), NULL, NULL, 1); - babl_space_from_chromaticities ( + babl_chromaticities_make_space ( "Bruce", 0.3127, 0.3290, /* D65 */ 0.6400, 0.3300, @@ -463,7 +463,7 @@ computations of uniform gray axis */ 0.1500, 0.0600, babl_trc("1.8"), NULL, NULL); - babl_space_from_chromaticities ( + babl_chromaticities_make_space ( "PAL", 0.3127, 0.3290, /* D65 */ 0.6400, 0.3300, @@ -471,7 +471,7 @@ computations of uniform gray axis */ 0.1500, 0.0600, babl_trc("2.2"), NULL, NULL, 1); - babl_space_from_chromaticities ( + babl_chromaticities_make_space ( "SMPTE-C", 0.3127, 0.3290, /* D65 */ 0.6300, 0.3300, @@ -479,7 +479,7 @@ computations of uniform gray axis */ 0.1550, 0.0700, babl_trc("2.2"), NULL, NULL, 1); - babl_space_from_chromaticities ( + babl_chromaticities_make_space ( "ColorMatch", 0.34567, 0.3585, /* D50 */ 0.6300, 0.3400, @@ -487,7 +487,7 @@ computations of uniform gray axis */ 0.1500, 0.0750, babl_trc("1.8"), NULL, NULL, 1); - babl_space_from_chromaticities ( + babl_chromaticities_make_space ( "Don RGB 4", 0.34567, 0.3585, /* D50 */ 0.6960, 0.3000, @@ -496,7 +496,7 @@ computations of uniform gray axis */ babl_trc("1.8"), NULL, NULL, 1); #endif - babl_space_from_chromaticities ( + babl_chromaticities_make_space ( "ACEScg", 0.32168, 0.33767, 0.713, 0.293, @@ -504,7 +504,7 @@ computations of uniform gray axis */ 0.128, 0.044, babl_trc("linear"), NULL, NULL, 1); - babl_space_from_chromaticities ( + babl_chromaticities_make_space ( "ACES2065-1", 0.32168, 0.33767, 0.7347, 0.2653, diff --git a/babl/babl.h b/babl/babl.h index 39cb097..1d7d433 100644 --- a/babl/babl.h +++ b/babl/babl.h @@ -450,6 +450,44 @@ void babl_set_user_data (const Babl *babl, void *data); void * babl_get_user_data (const Babl *babl); +/** + * babl_space_from_chromaticities: + * + * Creates a new babl-space/ RGB matrix color space definition with the + * specified CIE xy(Y) values for white point: wx, wy and primary + * chromaticities: rx,ry,gx,gy,bx,by and TRCs to be used. After registering a + * new babl-space it can be used with babl_space() passing its name; + * + * Internally this does the math to derive the RGBXYZ matrix as used in an ICC + * profile. + */ +const Babl * babl_chromaticities_make_space (const char *name, + double wx, double wy, + double rx, double ry, + double gx, double gy, + double bx, double by, + const Babl *trc_red, + const Babl *trc_green, + const Babl *trc_blue, + int equalize_matrix); + + +/** + * babl_trc_gamma: + * + * Creates a Babl TRC for a specific gamma value, it will be given + * a name that is a short string representation of the value. + */ +const Babl * babl_trc_gamma (double gamma); + +/** + * babl_trc: + * + * Look up a TRC by name, "sRGB" "1.0" "linear" and "2.2" are recognized + * strings in a stock babl configuration. + */ +const Babl * babl_trc (const char *name); + #ifdef __cplusplus } #endif diff --git a/export-symbols b/export-symbols index 1b3622b..952aeb6 100644 --- a/export-symbols +++ b/export-symbols @@ -41,12 +41,14 @@ babl_sampling babl_set_user_data babl_space babl_space_from_xyz +babl_chromaticities_make_space babl_space_get_rgbtoxyz babl_space_to_xyz babl_ticks babl_type babl_type_new babl_trc +babl_trc_gamma babl_space_to_icc babl_db_exist_by_name babl_db_find -- 2.30.2